<%@ page import="java.util.HashMap" %>
<%@ page import="utils.string.session.SessionStringUtil" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="vo.TableUsing" %>
<%@ page import="utils.string.date.DateToStringUtil" %>
<%@ page import="vo.User" %><%--
  Created by IntelliJ IDEA.
  User: Chris
  Date: 2021/5/11
  Time: 20:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>${sessionScope.User.user_name}正在查看所有使用中设备</title>
</head>
<body>
<h2>欢迎${sessionScope.User.user_name}查看使用中设备</h2><br>
<%
    User user = (User) request.getSession().getAttribute(SessionStringUtil.USER);
    request.getSession().setAttribute(SessionStringUtil.USER,user);
    HashMap allTableUsings = (HashMap)session.getAttribute(SessionStringUtil.ALL_USING);
%>
<table border="1">
    <tr bgcolor="pink">
        <td>使用编号</td>
        <td>设备名称</td>
        <td>申请人</td>
        <td>数目</td>
        <td>申请理由</td>
        <td>时间</td>
        <td>归还</td>
    </tr>
    <%
        Set set = allTableUsings.keySet();
        Iterator ite = set.iterator();
        while(ite.hasNext()){
            int tableUsingId = (int)ite.next();
            TableUsing tableUsing = (TableUsing) allTableUsings.get(tableUsingId);
            String date = DateToStringUtil.DateToString(tableUsing.getUsing_date());
    %>
    <tr bgcolor="yellow">
        <td><%=tableUsing.getUsing_id()%></td>
        <td><%=tableUsing.getEquip_name()%></td>
        <td><%=tableUsing.getUser_name()%></td>
        <td><%=tableUsing.getUsing_num()%></td>
        <td><%=tableUsing.getUsing_reason()%></td>
        <td><%=date%></td>
        <td><a href="giveBackComfirm.jsp?tableUsingId=<%=tableUsingId%>&equip_id">归还</a></td>
    </tr>
    <%} %>
</table>
<br>
<a href="servlet/AddEquipmentServlet" methods="get">返回查看所有可使用的设备情况</a><br>
</body>
</html>
